<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      template="./template/UserTemplate.xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./template/UserTemplate.xhtml">

            <ui:define name="main_content">
                <h1 class="heading colr">Insert Mark</h1>

                <h:form>
                    <h:panelGrid id="panel" columns="2" cellpadding="5">
                        Curriculum:
                        <h:selectOneMenu  id="curriculum" style="width: 150px;" value="#{marksManagerManagedBean.curriculumId}" 
                                          >
                            <f:selectItem itemLabel="Select Curriculum" itemValue="" noSelectionOption="true"/>
                            <f:selectItems var="curriculum" value="${marksManagerManagedBean.listCurriculum}"
                                           itemLabel="${curriculum.curriculumName}"
                                           itemValue="${curriculum.curriculumId}" />
                            <p:ajax  update="semester" />
                        </h:selectOneMenu>

                        Semester:
                        <h:selectOneMenu id="semester" style="width: 150px;"  value="#{marksManagerManagedBean.semesterId}"
                                         >
                            <f:selectItem itemLabel="Select Semester" itemValue="" noSelectionOption="true"/>
                            <f:selectItems var="semester" value="#{marksManagerManagedBean.laySemester(marksManagerManagedBean.curriculumId)}"
                                           itemLabel="${semester.semesterName}"
                                           itemValue="${semester.semesterId}" />
                            <p:ajax  update="panel2" />

                        </h:selectOneMenu>
                    </h:panelGrid>

                    <h:panelGrid id="panel2" columns="2" cellpadding="5">
                        Subject:
                        <h:selectOneMenu id="subject" style="width: 150px;" value="#{marksManagerManagedBean.subjectId}">
                            <f:selectItem itemLabel="Select Subject" itemValue="" noSelectionOption="true"/>
                            <f:selectItems var="subject" value="#{marksManagerManagedBean.listSubject}"
                                           itemLabel="${subject.subjectName}"
                                           itemValue="${subject.subjectId}" />
                            <p:ajax  update="examination" />
                        </h:selectOneMenu>

                        Examination:
                        <h:selectOneMenu id="examination" style="width: 150px;" value="#{marksManagerManagedBean.examinationId}" title="Select Examination">
                            <f:selectItem itemLabel="Select Examination" itemValue="" noSelectionOption="true"/>
                            <f:selectItems var="examination" value="#{marksManagerManagedBean.listExamination}"
                                           itemLabel="${examination.examName}"
                                           itemValue="${examination.examId}" />
                        </h:selectOneMenu>

                        Class:
                        <h:selectOneMenu id="class" style="width: 150px;" value="#{marksManagerManagedBean.classId}" title="Select Class" rendered="true"
                                         valueChangeListener="#{marksManagerManagedBean.layStudent(marksManagerManagedBean.classId)}">
                            <f:selectItem itemLabel="Select Class" itemValue="" noSelectionOption="true"/>
                            <f:selectItems var="class" value="#{marksManagerManagedBean.listClass}"
                                           itemLabel="${class.className}"
                                           itemValue="${class.classId}" />
                            <p:ajax update="panel3" />
                        </h:selectOneMenu>
                    </h:panelGrid>

                    <!--

                                        <h:panelGrid id="panel3">
                                            <h:form prependId="false" styleClass="form panel" style="min-height:280px;" id="form">
                                                <p:dataTable var="student" value="#{marksManagerManagedBean.listStudent}"
                                                             paginator="false" rows="10"
                                                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                                                             rowsPerPageTemplate="1">
                                                    <p:column>
                                                        <f:facet name="header">Roll No</f:facet>
                                                        <h:outputText value="#{student.studentRollNo}" />
                                                    </p:column>

                                                    <p:column>
                                                        <f:facet name="header">Name</f:facet>
                                                        <h:outputText value="#{student.studentName}"/>
                                                    </p:column>

                                                    <p:column>
                                                        <f:facet name="header">
                                                            <h:outputText value="Mark"/>
                                                        </f:facet>
                                                        <h:inputText style="width: 50px;" value="1"/>
                                                    </p:column>



                                                    <p:column>
                                                        <f:facet name="header">
                                                            <h:outputText value="Edit" />
                                                        </f:facet>
                                                        <h:commandLink value="Edit" action="studentDetails">
                                                            <f:setPropertyActionListener target="#{studentManagedBean.studentSelected}" value="#{student}" />
                                                        </h:commandLink>
                                                    </p:column>

                                                </p:dataTable>

                                                <h:commandButton styleClass="button button-blue" style="margin-right: 7px" value="Submit" action="#{branchManagedBean.add}" />
                                            </h:form>

                                            <h:form>
                                                <br/>
                                                Send request approup to faculty :
                                                <h:selectOneMenu id="class" style="width: 150px;" value="#{staffManagedBean.staffId}">
                                                    <f:selectItem itemLabel="Select Teacher" itemValue="" noSelectionOption="true"/>
                                                    <f:selectItems var="teacher" value="${staffManagedBean.all}"
                                                                   itemLabel="${teacher.staffName}"
                                                                   itemValue="${teacher.staffId}" />
                                                    <p:ajax update="panel3" />
                                                </h:selectOneMenu>
                                                <br/>
                                                <h:commandButton styleClass="button button-blue" style="margin-right: 7px" value="Send" action="#{branchManagedBean.add}" />
                                            </h:form>
                                        </h:panelGrid>-->


                    <!--                
                                    <br/>
                                    Examination:
                                    <h:selectOneMenu style="width: 120px;" value="#{semesterManagedBean.semesterId}" title="Select Semester">
                                        <c:forEach var="semester" items="${semesterManagedBean.all}" >
                                            <f:selectItem itemLabel="${semester.semesterName}" itemValue="${semester.semesterId}" />
                                        </c:forEach>
                                    </h:selectOneMenu>
                                    <br/>
                                    Class:
                                    <h:selectOneMenu style="width: 120px;" value="#{semesterManagedBean.semesterId}" title="Select Semester">
                                        <c:forEach var="semester" items="${semesterManagedBean.all}" >
                                            <f:selectItem itemLabel="${semester.semesterName}" itemValue="${semester.semesterId}" />
                                        </c:forEach>
                                    </h:selectOneMenu>

                                    <dd><label>Class</label>
                                        <h:selectOneMenu style="width: 120px;" value="#{classManagedBean.classId}" title="Select Curriculum">
                                            <c:forEach var="class" items="${classManagedBean.all}" >
                                                <f:selectItem itemLabel="${classManagedBean.className}" itemValue="${class.classId}" />
                                            </c:forEach>
                                        </h:selectOneMenu>
                                    </dd>-->

                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
